#ifndef SERVICENODE_H
#define SERVICENODE_H

/**
 * @copyright Copyright (c) 2025 
 * CSG Digital Grid Technology (Guangdong) Co., Ltd.
 * @author zhouyan
*/
#include "sys_inc.h"
#include "datacenter.h"

class IDevice;
class RegBase;
class SensorNode
{
    friend class sensormanager;
    typedef std::map<std::string, const RegBase *> Attrbutes;
    typedef std::map<std::string, std::string> YkNodeLists;
public:
    SensorNode();
    ~SensorNode();

    IDevice *dev(void) const { return dev_; }
    void setDev(IDevice *dev) { dev_ = dev; }

    DC::DevInfo & devInfo(void) { return dev_info_; }
    const DC::DevInfo & devInfo(void) const { return dev_info_; }

    bool addAttr(const std::string &name, const RegBase *reg);
    const RegBase* findReg(const std::string &name);
    bool addYkList(const std::string &name, const std::string &regname);
    const std::string findYkregname(const std::string &name) const;

protected:
    IDevice *dev_;
    Attrbutes attrs_;
    YkNodeLists yklist_;
    YkNodeLists dzlist_;

    DC::DevInfo dev_info_;
};

#endif // IDEVICE_H
